package com.hc.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*当前更改Ribbon 负载均衡配置类*/
@Configuration
public class RibbonConfig {

    //修改负载均衡的默认算法，需要在spring中从新注入IRule的实现
    @Bean
    public IRule myRule(){
        return new RandomRule();//随机算法
    }

}
